package com.zyf.article.controller;

import com.zyf.article.service.impl.ArticleServiceImpl;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ArticleController {
    @Autowired
    ArticleServiceImpl articleService;
    /**
     * 文章审核
     //     * @param id 文章ID
     * @return
     */
    @RequestMapping(value="/examine/{id}",method= RequestMethod.PUT)
    public Result examine(@PathVariable String id) {
//        1审核成功
       articleService.examine("1", id);
       return new Result(true, StatusCode.OK,"审核成功");
    }

    /**
     * 点赞
     //     * @param id 文章ID
     * @return
     */
    @RequestMapping(value="/thumbup/{id}",method=RequestMethod.PUT)
    public Result updateThumbup(@PathVariable String id) {
        articleService.updateThumbup(id);
        return new Result(true, StatusCode.OK,"点赞成功");
    }
}
